package com.itbour.service.trade.impl;

import java.util.List;
import java.util.Map;

import com.itbour.com.page.JspPage;
import com.itbour.com.page.Page;
import com.itbour.dao.trade.PaymentHisInfoDao;
import com.itbour.dto.trade.PayInfoDto;
import com.itbour.dto.trade.PaymentHisInfoDto;
import com.itbour.service.trade.PaymentHisInfoService;

public class PaymentHisInfoServiceImpl implements PaymentHisInfoService{
	
	private PaymentHisInfoDao paymentHisInfoDao;
	
	
	public Page pagePaymentHisInfo(Map<String, Object> parm, Integer pageNo,
			Integer pageSize) {
		try {
			Page result = null;
			// 实际起始位置
			int skipResults = JspPage.getStartOfPage(pageNo, pageSize);
			int totalSize = paymentHisInfoDao.getPaymentHisInfoCnt(parm);
			while(totalSize >0 && totalSize <= skipResults){
				skipResults= skipResults - pageSize;
				pageNo = pageNo -1;
			}
			// 分页检索
			parm.put("pageSize", pageSize);
			parm.put("skipResults", skipResults);
			List<PaymentHisInfoDto> data = paymentHisInfoDao.getPaymentHisInfo(parm);
			result = new JspPage(skipResults, totalSize, pageSize, data);
			return result;
		} finally {
		}
	}
	


	public List<PayInfoDto> getPayReturnInfo(Map<String, Object> parm) {
		return paymentHisInfoDao.getOnePayInfo(parm);
	}

	public PaymentHisInfoDao getPaymentHisInfoDao() {
		return paymentHisInfoDao;
	}
	public void setPaymentHisInfoDao(PaymentHisInfoDao paymentHisInfoDao) {
		this.paymentHisInfoDao = paymentHisInfoDao;
	}
}
